<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="author" content="wangzhichao">
<title>限购类型管理</title>
<script type="text/javascript" language="JavaScript" src="../script/common.js"></script>
<script type="text/javascript" language="JavaScript">
			var qt;
			function load() {
				Eui.showNavigation();//导航
				setPages(["listview","treeDet","formTitle1"])
				createTable();
			}
			
			//生成表格，创建QueryTable对象
			function createTable(){
				var columns = []
				columns[0] = {type:"checkbox"};
				columns[1] = {defOrder:"asc"};
				columns[2] = {render:bitFunc};	
				columns[3] = {title:"操作",width:10,render:oparetFunc,align:"center",order:true};	
				qt = new QueryTable("fuel_restrict_mgnt","searchForm","datalist",columns,{
					buttons:[
						{value:"增加",actions:onNew},
						{value:"删除",actions:OnDelete}
					]
				});
			}
			function bitFunc(v,r){
				return "<a href=# onclick=showDetail('"+r[0]+"')>"+v+"</a>"
			}
			function showDetail(id){
				DWR.call("goodsService.getRestrictedGoods",id , function(backValue) {
					backValue.Goods.goodsTypeName = backValue.Goods.goodsName;
					backValue.Goods.bitPos =  backValue.RestrictedGoods.bitPos;
					backValue.Goods.goodsCategoryType = backValue.goodsCategory.catName;
					backValue.Goods.baseUOM = backValue.baseUOM
					Common.showDetail("formTitle1",backValue.Goods);
					switchPage('formTitle1');
				});
			}
			function oparetFunc(v,r){
				return "<a href=# onclick=onEdit('"+v+"')>修改</a>";
			}
			function onEdit(id){
				DWR.call("goodsService.getRestrictedGoods",id , function(backValue) {
					Common.setValues(dataform,backValue.RestrictedGoods);
					dataform.goodsTypeName.value = backValue.Goods.goodsName;
					switchPage('treeDet');
				});
			}
			function OnDelete() {
			 	var ids1 = qt.getBoxValue();
				if(ids1==null||ids1==""){
					showInformation("请选择您要删除的数据");return;
				}
				if(!(showQuestion("您确认删除吗?"))){
					return;
				}
				ids1 = ids1.split(",");
				DWR.call("goodsService.deleteRestrictedGoods",ids1 , function() {
					showInformation("删除成功");
					qt.showTable();
				});
			}
			
			/**组织机构保存**/
			function onSave() {
				if(!checkForm(dataform))return;
				if(!(showQuestion("您确认保存吗?"))){
					return;
				}
				var form = Common.getValues(dataform);
				DWR.call("goodsService.saveRestrictedGoods", form, function(){
					showInformation("保存成功");
					switchPage('listview');
					qt.showTable();
				},{blockScreen:true})
			}
			/**组织机构明细**/
			//新建组织机构
			function onNew() {
				dataform.reset();
				switchPage('treeDet');
			}
			
			function onCancel() {
				switchPage('listview');
			}
			
			function selGoodsType(){
				var v = openDialogFrame("/basic/goods_type_list.html?isShow="+true,'选择商品类型',464,700);
				if(v){
					dataform.goods.value = v[0];
					dataform.goodsTypeName.value = v[2];
				}
			}
		</script>
</head>

<body onload="load()" class="noScroll">
<!--页面导航-->
<div class="nav">
<div id="nav">&nbsp;</div>
</div>
<div id="listview" class="listview" style=""><!--查询条件form-->
<div class="searchForm">
<form id="searchForm" name="searchForm">
<table cellSpacing=0 cellPadding=6 width="100%" border=0>
	<tr>
		<td><label>限购编码</label> <input type="text" name="bitPos"
			onblur="checkV(this,'number')" maxlength=12></td>
		<td><label>限购油品</label> <input type="text" name="goodsName"
			onblur="checkV(this,'')" maxlength=32></td>
		<td>
		<button type="button" onclick="qt.showTable()">查 询</button>
		</td>
	</tr>
</table>
</form>
</div>
<div id="datalist"></div>
</div>
<!--查询结构列表-->
<div id="treeDet" class="scrollDiv" style="display: none;">
<form id="dataform" name="dataform"><input type="hidden"
	name="id"> <input type="hidden" name="goods">
<div class="form">

<div class="formTitle">限购油品信息</div>
<table cellSpacing="0" cellPadding="4" width="100%" border="0"
	class="col2 label4">
	<tr>
		<td width="50%"><label>限购编码</label> <input type="text"
			name="bitPos" onblur="checkV(this,'number',true)" maxlength=5>
		<span class="des">*</span></td>
		<td width="50%"><label>限购油品</label> <input type="text"
			name="goodsTypeName" onblur="checkV(this,'',true);" maxlength=20
			readonly class="readonly"> <a class=orga
			href="javascript:void(0)" onclick="selGoodsType()" disabled>&nbsp;&nbsp;</a><font
			class="des">*</font></td>
	</tr>
</table>
</div>
<p>
<button type="button" name="savebt" onclick="onSave()">保 存</button>
<button type="button" name="cancelbt" onclick="onCancel()">取 消</button>
</p>
</form>
</div>
<div id="formTitle1" style="display: none;">
<div class="form">
<div class="formTitle">限购商品信息</div>
<table cellSpacing=0 cellPadding=2 width="100%" border=0
	class="viewTable" class="col2 label4">
	<tr>
		<td width="50%"><label>限购编码</label> <span id="bitPos"></span></td>
		<td><label>限购油品</label> <span id="goodsTypeName"></span></td>
	</tr>
</table>
</div>
<div class="form">
<div class="formTitle">商品明细</div>
<table cellSpacing=0 cellPadding=2 width="100%" border=0
	class="viewTable" class="col2 label4">
	<tr>
		<td width="50%"><label>商品编号</label> <span id="goodsCode"></span></td>
		<td><label>商品名称</label> <span id="goodsName"></span></td>
	</tr>
	<tr>
		<td><label>商品类型</label> <span id="goodsCategoryType"></span></td>
		<td><label>计量单位</label> <span id="baseUOM"></span></td>
	</tr>
</table>
</div>
<p>
<button type="button" name="backbt" onclick="onCancel()">返 回</button>
</p>
</div>
</body>
</html>